package budget;

import java.util.ArrayList;
import java.util.Collection;

public class Menu extends Service{

	public Menu(String menuName, Service ... courses){
		super(ServiceType.MENU, menuName, 0);
		double tot = 0;
		this.courses = new ArrayList<Service>();
		for(int i = 0 ; i<courses.length; i++){
			Service s = courses[i];
			if(!s.getServiceType().name().equalsIgnoreCase("COURSE"))
				throw new IllegalArgumentException("service not courses");
			this.courses.add(courses[i]);
			tot += courses[i].getCost();
		}
		super.setCost(tot);
	}
	
	public Menu(String menuName, Collection<Service> courses){
		super(ServiceType.MENU, menuName, 0);
		this.courses = courses;
		double tot = 0;
		for(Service s : courses){
			tot += s.getCost();
		}
		super.setCost(tot);
	}
	private Collection<Service> courses;
}
